# Maintainer: Michał Adamski <michal@ert.pl>
pkgname=btcd
pkgver=0.24.0
_pkgver=${pkgver/_/-}
pkgrel=0
pkgdesc="Alternative full node bitcoin implementation written in Go"
url="https://github.com/btcsuite/btcd#btcd"
arch="all !x86 !armhf !armv7"
license="ISC"
makedepends="go"
source="https://github.com/btcsuite/btcd/archive/v$_pkgver/btcd-$_pkgver.tar.gz"
builddir="$srcdir/$pkgname-$_pkgver"

# secfixes:
#   0.23.3-r0:
#     - CVE-2022-39389

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	mkdir bin
	go build -trimpath -v -o bin . ./cmd/...
}

check() {
	GOFLAGS="${GOFLAGS/-trimpath/}" go test ./...
}

package() {
	for bin in bin/*; do
		install -Dm755 $bin "$pkgdir"/usr/$bin
	done
}
sha512sums="
0786f74396f77cab7ac977483ea291bf57d2abc68cf824627424987386d94c2fe071e694a289f21a853a3a244e11b9f7fdf9ce8926684345752efe668f852b98  btcd-0.24.0.tar.gz
"
